<?php

	include_once "../../../config.inc.php";
	
	$idElement = $_GET["id"];
	$typeElement = $_GET["element"];
	$orderElement = $_GET["order"];
				
	$updateQuery = "";
	$connection = pg_connect("host=".W." port=".V." dbname=".Z." user=".Y." password=".X) or die ("Falló la conexion");
	
		switch ($typeElement){
							
							case TEXT_ELEMENT: $updateQuery = "UPDATE ELEMENT_TEXT SET element_order = ".$orderElement." where element_id = ".$idElement.";";
							$insert = pg_query($connection,$updateQuery); 	
							//echo $updateQuery;
							break;
							
							case MENU_LIST: $updateQuery = "UPDATE MENU_LIST SET element_order = ".$orderElement." where element_id = ".$idElement.";";
							$insert = pg_query($connection,$updateQuery);
							//echo $updateQuery;
							break;
							
							case GALLERY_ELEMENT: $updateQuery = "UPDATE GALLERY_ELEMENT SET element_order = ".$orderElement." where element_id = ".$idElement.";"; 						
							$insert = pg_query($connection,$updateQuery);
							//echo $updateQuery;
							break;
						}
	?>